#!/bin/bash

if (( $EUID == 0 )); then
  echo "Eseguire lo script come utente non amministratore"
  exit
fi

# installo estensioni per git, java, laravel, spring, cobol
codium --install-extension bmewburn.vscode-intelephense-client
codium --install-extension codingyu.laravel-goto-view
codium --install-extension donjayamanne.githistory
codium --install-extension jacqueslucke.gcov-viewer
codium --install-extension michelemelluso.gitignore
codium --install-extension ms-ceintl.vscode-language-pack-it
codium --install-extension ocamlpro.superbol
codium --install-extension olegkunitsyn.gnucobol-debug
codium --install-extension onecentlin.laravel-blade
codium --install-extension onecentlin.laravel5-snippets
codium --install-extension porifa.laravel-intelephense
codium --install-extension redhat.java
codium --install-extension stef-k.laravel-goto-controller
codium --install-extension vmware.vscode-spring-boot
codium --install-extension vscjava.vscode-java-debug
codium --install-extension vscjava.vscode-java-test
codium --install-extension vscjava.vscode-maven
codium --install-extension vscjava.vscode-spring-boot-dashboard
codium --install-extension vscjava.vscode-spring-initializr
codium --install-extension xdebug.php-debug

# se la dir non esiste la creo
DIR=~/.config/VSCodium/User
if [ ! -d "$DIR" ]; then
  mkdir -p "$DIR"
fi

# setto VSCodium come preferisco
cat > ~/.config/VSCodium/User/settings.json  << EOF
{
  "editor.minimap.enabled": false,
  "editor.tabSize": 2,
  "editor.detectIndentation": false,
  "editor.insertSpaces": true,
  "files.trimTrailingWhitespace": true,
  "php.validate.executablePath": "/usr/bin/php",
  "files.trimFinalNewlines": true,
  "workbench.editor.enablePreviewFromQuickOpen": true,
  "workbench.editor.enablePreviewFromCodeNavigation": true,
  "java.jdt.ls.java.home": "/usr/lib/jvm/default-java",
  "boot-java.rewrite.reconcile": true,
  "redhat.telemetry.enabled": false,
}
EOF
